<template>
    <div class="socket">
        <topnav>{{friendname}}</topnav>
        <showinfor></showinfor>
        <sendinfor></sendinfor>
    </div>
</template>

<script>
import { computed, onBeforeUnmount } from 'vue';
import { useStore } from 'vuex';
import Topnav from '../components/public/Topnav.vue';
import Showinfor from '../components/socketview/Showinfor.vue';
import Sendinfor from '../components/socketview/Sendinfor.vue';

export default {
  name: 'Socketview',
  components: {
    Topnav,
    Showinfor,
    Sendinfor,
  },
  setup() {
    const Store = useStore();
    const friendname = computed(() => Store.state.basicinfor.iscallcode);
    onBeforeUnmount(() => {
      // 退出聊天界面时更新时间
      Store.commit('CHOOSETIME', friendname.value);
    });
    return {
      friendname,
    };
  },
};
</script>

<style scoped>
</style>
